0.4.1 • Published 11 months ago

@ssc-hermes/profile v0.4.1

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
11 months ago

profile tests

Profile data for hermes.

install

npm i -S @ssc-hermes/profile

example

This creates a profile object in memory. You would then want to save the profile somehow.

minimal parameters

import * as odd from '@oddjs/odd'
import * as profile from '@ssc-hermes/profile'

const program = await odd.program({
    namespace: { creator: 'creator', name: 'test' },
    debug: true
})

const { crypto } = program.components

// minimal parameters
// this assumes that the rootDID is the current machine
const newProfile = await profile.create(crypto, {
    humanName: 'Alice'
})

// => {
//   humanName: 'Alice',
//   timestamp: 1683435717111,
//   username: 'fyrckpeigjv23y7bc572af6o7jyovstt',
//   rootDID: 'did:key:z13V3S...',
//   author: 'did:key:z13V3S...',
//   signature: 'i5rb0sMDx...'
// }

more parameters

const newProfile2 = await profile.create(crypto, {
    humanName: 'Alice',
    // can also create a description
    description: 'describing things',
    // if you are writing from a machine that is not the root
    // machine, pass in the rootDID
    rootDID: 'did:key:z13V3...'
})

util.createUsername

Helper that will create a DNS friendly, unique username based on your public key.

import * as util from '@ssc-hermes/profile/util'

test('create username', async t => {
    const { crypto } = program.components
    const username = await util.createUsername(crypto)
    t.ok(username, 'should create a username')
    t.equal(typeof username, 'string', 'usernmae should be a string')
    t.equal(username.length, 32, 'should be 32 chars long')
})

profile type

interface Profile {
    humanName: string
    author: string
    username: string
    rootDID: string
    description?: string
    timestamp:number
}
0.4.1

11 months ago

0.4.0

11 months ago

0.3.6

12 months ago

0.3.5

1 year ago

0.3.4

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago